import Request from '@/libs/request'

/**用户查询报警历史记录 */
export const uSelectDevReportDataByQueryVo = (
  data: {
    devId?: string | number
    userId: string | number
    startTime?: string
    endTime?: string
    paramCode?: string
    page?: number
    size?: number
    devReportType?: string
  } & Omit<Paging, 'start'>
) => Request.get<PagingResponse<Alarm.TableData>>('/platFormSubUser/selectDevReportData', {
  devId: data.devId,
  platFormSubUserId: data.userId,
  startTime: data.startTime,
  endTime: data.endTime,
  paramCode: data.paramCode,
  page: data.page,
  size: data.size,
  devReportType: data.devReportType
})

/**用户查询所有设备报警配置信息 */
export const uSelectWebDevReportConf = (data: { devId: string }) =>
  Request.get<Alarm.DevConfigData[]>('/platFormSunUser/select/devReportConf', data)

/**用户修改报警配置 */
export const uEditReportConf = (data: Alarm.EditConfigData) =>
  Request.get<null>('/user/uEditReportConf', data)

/**用户启用报警配置 */
export const uOpenReportConf = (data: { devReportConfId: number, platFormSubUserId: string | null }) =>
  Request.get<null>('/platFormSubUser/open/reportConf', data)

/**用户停用报警配置 */
export const uDisableReportConf = (data: { devReportConfId: number, platFormSubUserId: string | null }) =>
  Request.get<null>('/platFormSubUser/close/reportConf', data)


/* 查询报警类型 */
export const selectDevReportTypeApi = () => {
  return Request.post('/platFormSunUser/select/DevReportType')
}
